/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       progress_handler.h

	$Header: /game/progress_handler.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( PROGRESS_HANDLER_H_INCLUDED )
#define PROGRESS_HANDLER_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// abstract progress handler.  By default, does nothing.
class t_progress_handler
{
public:
	t_progress_handler();
	virtual ~t_progress_handler();

	int  get_maximum() const;
	int  get_value() const;
	void increment( int arg );
	void increment_maximum( int arg );
	void set_maximum( int arg );
	void set_value( int arg );
protected:
	virtual void update_progress();

	int       m_value;
	int       m_maximum;
};

inline t_progress_handler::t_progress_handler()
{
	m_value = 0;
	m_maximum = 0;
}

inline int  t_progress_handler::get_maximum() const
{
	return m_maximum;
}

inline int  t_progress_handler::get_value() const
{
	return m_value;
}

inline void t_progress_handler::increment( int arg )
{
	if (arg != 0)
	{
		m_value += arg;
		update_progress();
	}
}

inline void t_progress_handler::increment_maximum( int arg )
{
	if (arg != 0)
	{
		m_maximum += arg;
		update_progress();
	}
}

inline void t_progress_handler::set_maximum( int arg )
{
	if (arg != m_maximum)
	{
		m_maximum = arg;
		update_progress();
	}
}

inline void t_progress_handler::set_value( int arg )
{
	if (arg != m_value)
	{
		m_value = arg;
		update_progress();
	}
}

#endif // PROGRESS_HANDLER_H_INCLUDED